<admintpl file="header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="javascript:;">照片墙管理</a></li>
			<li><a href="{:U('Photo/add')}" target="_self">添加照片墙</a></li>
		</ul>
		<form class="well form-search" method="post" action="{:U('Photo/index')}">
			比赛名称：
			<select id="matchSelect" name="match_id" style="width: 300px;">
				<volist name="matches" id="vo">
					<if condition="$vo.id eq $formget['match_id']">
						<option value="{$vo.id}" selected="selected">{$vo.time}-{$vo.name}</option>
						<else />
						<option value="{$vo.id}">{$vo.time}-{$vo.name}</option>
					</if>
				</volist>
			</select>&nbsp;&nbsp;
			<input type="submit" class="btn btn-primary" value="搜索" />
		</form>
		<form class="js-ajax-form" action="" method="post">
			<table class="table table-hover table-bordered table-list">
				<thead>
					<tr>
						<th width="50">ID</th>
						<th width="50">比赛时间-名称</th>
						<th width="70">操作</th>
					</tr>
				</thead>
				<foreach name="posts" item="vo">
				<tr>
					<td>{$key+1}</td>
					<td>{$vo.time}-{$vo.name}</td>
					<td>
						<if condition="!empty($vo['url'])">
							<a href="{:sp_get_image_preview_url($vo['url'])}" target="_blank">查看</a> |
						</if>
						<!--
						<a href="{:U('Photo/edit',array('id'=>$vo['pid']))}">编辑</a> |-->
						<a href="javascript:void(0)" onclick="deleteItem({$vo.pid})">删除</a>
					</td>
				</tr>
				</foreach>
			</table>
			<div class="pagination">{$page}</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script src="__PUBLIC__/js/layer/layer.js"></script>
	<script>

		function deleteItem(id) {
			layer.confirm('您确定删除该照片？', {
				btn: ['确定','取消'] //按钮
			},function(){
				$.ajax({
					type: "POST",
					url: "{:U('Photo/delete')}",
					data: {id:id},
					success: function(result) {
						var result=eval("("+result+")");
						if(result.status){
							layer.msg(result.message,{time:500},function(){
								location.href = "{:U('Photo/index')}";
							});
						}else{
							layer.msg(result.message);
						}
					}
				});
			});
		}
	</script>
</body>
</html>